import Main from '@/view/main';

const page404 = {
    path: '/404',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
};
const pageRouter = [
    {
        path:'/',
        redirect:'/index',
    },
    {
        path:'/login',
        name:'login',
        meta:{
          title: "登录"
        },
        component:() => import("@/view/user/login.vue")
    },
    {
        path:'/register',
        name:'register',
        mata:{
          title: "注册"
        },
        component:() => import("@/view/user/register.vue")
    },
    {
        path:'/notebook',
        meta:{
          requireAuth:true,
          title: "notebook"
        },
        component:() => import("@/view/notebook/index.vue")
    },
    {
        path:'/',
        component: Main,
        children:[
            // 个人中心
            {
                path:'personal',
                name:'personal',
                redirect:'personal/balance',
                meta:{
                    requireAuth:true,
                    title: "个人中心"
                },
                components:{
                    default:() => import("@/view/user/personal/index.vue"),
                    footer:() => import('@/view/layout/footer.vue')
                },
                children:[
                    {
                        path:'balance',
                        name:'balance',
                        meta:{
                            requireAuth:true,
                            title: "余额"
                        },
                        component:() => import("@/view/user/personal/balance.vue")
                    },
                    {
                        path:'recharge',
                        name:'recharge',
                        meta:{
                            requireAuth:true,
                            title: "充值"
                        },
                        component:() => import("@/view/user/personal/reCharge.vue")
                    },
                    {
                        path:'myInfo',
                        name:'myInfo',
                        meta:{
                            requireAuth:true,
                            title: "个人信息"
                        },
                        component:() => import("@/view/user/personal/myInfo.vue")
                    },
                    {
                        path:'myCourse',
                        name:'myCourse',
                        meta:{
                            requireAuth:true,
                            title: "课程"
                        },
                        component:() => import("@/view/user/personal/myCourse.vue")
                    },
                    {
                        path:'myProject',
                        name:'myProject',
                        meta:{
                            requireAuth:true,
                            title: "项目"
                        },
                        component:() => import("@/view/user/personal/myProject.vue")
                    },
                    {
                        path:'myCompetition',
                        name:'myCompetition',
                        meta:{
                            requireAuth:true,
                            title: "竞赛"
                        },
                        component:() => import("@/view/user/personal/myCompetition.vue")
                    },
                    {
                        path:'dataFoundry',
                        name:'dataFoundry',
                        meta:{
                            requireAuth:true,
                            title: "数据集"
                        },
                        component:() => import("@/view/user/personal/dataFoundry.vue")
                    },
                    {
                        path:'myFavorite',
                        name:'myFavorite',
                        meta:{
                            requireAuth:true,
                            title: "收藏"
                        },
                        component:() => import("@/view/user/personal/myFavorite.vue")
                    },
                ]

            },
            // 账号设置
            {
                path:'setting',
                name:'setting',
                meta:{
                    requireAuth:true,
                    title: "设置"
                },
                components:{
                    default:() => import("@/view/user/setting.vue"),
                    footer:() => import('@/view/layout/footer.vue')
                }
            },
            // 首页
            {
                path:'index',
                name:'index',
                meta:{
                    requireAuth:false,
                    title: "首页"
                },
                component:() => import("@/view/home/index.vue")
            },
            // 教育模块
            {
                path:'education',
                name:'education',
                meta:{
                    requireAuth:false,
                    title: "教育平台"
                },
                components:{
                    default:() => import("@/view/education/index.vue"),
                    footer:() => import('@/view/layout/footer.vue')
                }
            },
            {
                path:'education/:id',
                props:true,
                redirect:'education/:id/introduction',
                meta:{
                    requireAuth:true,
                },
                component:() => import("@/view/education/courseDetails/index.vue"),
                children:[
                    {
                        path:'introduction',
                        name:'introduction',
                        meta:{
                            requireAuth:true,
                            title: "简介"
                        },
                        component: ()=>import('@/view/education/courseDetails/introduction.vue'), 
                    },
                    {
                        path:'discuss',
                        name:'discuss',
                        meta:{
                            requireAuth:true,
                            title: "讨论"
                        },
                        component: ()=>import('@/view/education/courseDetails/discuss.vue'), 
                    },
                    {
                        path:'notes',
                        name:'notes',
                        meta:{
                            requireAuth:true,
                            title: "笔记"
                        },
                        component: ()=>import('@/view/education/courseDetails/notes.vue'), 
                    },
                    {
                        path:'question',
                        name:'question',
                        meta:{
                            requireAuth:true,
                            title: "提问"
                        },
                        component: ()=>import('@/view/education/courseDetails/question.vue'), 
                    },
                    {
                        path:'comment',
                        name:'comment',
                        meta:{
                            requireAuth:true,
                            title: "评论"
                        },
                        component: ()=>import('@/view/education/courseDetails/comment.vue'), 
                    },
                    {
                        path:'notebook',
                        name:'notebook',
                        meta:{
                            requireAuth:true,
                            title: "notebook"
                        },
                        component: ()=>import('@/view/education/courseDetails/notebook.vue'), 
                    },
                ]
            },
            // 数据集模块
            {
                path:'datalab',
                name:'datalab',
                meta:{
                    requireAuth:false,
                    title: "数据平台"
                },
                components:{
                    default:() => import("@/view/datalab/index.vue"),
                    footer:() => import('@/view/layout/footer.vue')
                }
            },
            {
                path:"datalab/:id",
                props:true,
                redirect:"datalab/:id/description",
                meta:{
                    requireAuth:true,
                },
                component: () => import("@/view/datalab/dataDetail/index.vue"),
                children:[
                    {
                        path:"description",
                        name:"description",
                        meta:{
                            requireAuth:true,
                            title: "概述"
                        },
                        component:()=>import("@/view/datalab/dataDetail/description.vue")
                    },
                    {
                        path:"file",
                        name:"file",
                        meta:{
                            requireAuth:true,
                            title: "文件"
                        },
                        component:()=>import("@/view/datalab/dataDetail/file.vue")
                    }
                ]
            },
            {
                path:"datalab/history/:id",
                name:"history",
                meta:{
                    requireAuth:true,
                },
                component:()=>import("@/view/datalab/dataDetail/history.vue")
            },
            // 竞赛模块
            {
                path:'competitions',
                name:'competitions',
                meta:{
                    requireAuth:false,
                    title: "竞赛平台"
                },
                components:{
                    default:() => import("@/view/competitions/index.vue"),
                    footer:() => import('@/view/layout/footer.vue')
                }
            },
            {
                path:'competitions/:id',
                redirect:'competitions/:id/eventIntroduction',
                props:true,
                meta:{
                    requireAuth:true,
                },
                component: ()=>import("@/view/competitions/competitionDetails/index.vue"),
                children:[
                    {
                        path:'eventIntroduction',
                        name:'eventIntroduction',
                        meta:{
                            requireAuth:true,
                            title: "赛事简介"
                        },
                        component:()=>import("@/view/competitions/competitionDetails/eventIntroduction.vue")
                        
                    },
                    {
                        path:'eventData',
                        name:'eventData',
                        meta:{
                            requireAuth:true,
                            title: "数据"
                        },
                        component:()=>import("@/view/competitions/competitionDetails/eventData.vue")
                        
                    },
                    {
                      path:'eventDiscuss',
                      name:'eventDiscuss',
                      meta:{
                          requireAuth:true,
                          title: "论坛"
                      },
                      component:()=>import("@/view/competitions/competitionDetails/eventDiscuss.vue")
                      
                  },
                    {
                        path:'eventGrade',
                        name:'eventGrade',
                        meta:{
                            requireAuth:true,
                            title: "我的成绩"
                        },
                        component:()=>import("@/view/competitions/competitionDetails/eventGrade.vue")
                        
                    },
                    {
                        path:'eventGroup',
                        name:'eventGroup',
                        meta:{
                            requireAuth:true,
                            title: "我的团队"
                        },
                        component:()=>import("@/view/competitions/competitionDetails/eventGroup.vue")
                        
                    },
                    {
                        path:'eventRank',
                        name:'eventRank',
                        meta:{
                            requireAuth:true,
                            title: "排行榜"
                        },
                        component:()=>import("@/view/competitions/competitionDetails/eventRank.vue")   
                    },
                ]
            },
            // 灯塔工厂模块
            {
                path:'lighthouse',
                name:'lighthouse',
                meta:{
                    requireAuth:false,
                    title: "灯塔工厂"
                },
                components:{
                    default:() => import("@/view/lighthouse/index.vue"),
                    footer:() => import('@/view/layout/footer.vue')
                }
            },
            // 订单模块
            {
                path:'order/:id/:current/:renew', // :id 课程或者数据集或者项目的id  :current 课程为0 数据集为1 项目为2  :renew 购买为0 续费为1
                name:'order',
                meta:{
                    requireAuth:true,
                    title: "订单"
                },
                components:{
                    default:() => import("@/view/order/index.vue"),
                    footer:() => import('@/view/layout/footer.vue')
                }
            }
        ]
    }
]
export default [
    page404,
    ...pageRouter
]
